#define _CRT_SECURE_NO_WARNINGS
#include<vector>
#include<iostream>
using namespace std;
class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> vv(numRows);
        for (int i = 0; i < numRows; ++i)
        {
            vv[i].resize(i + 1);
        }
        for (auto& ch : vv)
        {
            ch.front() = ch.back() = 1;
        }
        for (int i = 2; i < numRows; ++i)
        {
            for (int j = 1; j < i; ++j)
            {
                vv[i][j] = vv[i - 1][j - 1] + vv[i - 1][j];
            }
        }
        return vv;
    }
};
int main()
{
    Solution s;
    vector<vector<int>> vv = s.generate(5);
    for (auto& ch : vv)
    {
        for (auto& c : ch)
        {
            cout << c << ' ';
        }
        cout << endl;
    }
    return 0;
}